package de.cbf.cam.dsa.model.entities.maneuvers;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToOne;

import de.cbf.cam.dsa.model.definitions.BattleRollDefinition;
import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.entities.Environment;
import de.cbf.cam.dsa.model.persistence.Header;
import de.cbf.util.entities.IntString;
import de.cbf.util.modifier.entities.ModifierString;

@Entity
//because resolver do not have own data they can all be in one table
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class ManeuverResolverBase extends Header {
	/**
	 * @uml.property  name="accordingManeuver"
	 * @uml.associationEnd  inverse="resolver:de.cbf.cam.dsa.model.entities.maneuvers.OneManeuver"
	 */
	protected OneManeuver accordingManeuver;

	/**
	 *  method to determine if a maneuver is possible and with what min modifiers
	 * @param attacker
	 * @param defender
	 * @param env
	 * @return if impossible returns an empty List or null
	 * 			other wise List of modifiers with reasons
	 */
	public abstract List<IntString> isPossibleFromSituation(BattleChar attacker,BattleChar defender, Environment env);
	/** set the modifiers from this very maneuver
	 * (like +5 with Wuchtschlag +5)
	 *
	 * 	@return
	 */
	public abstract List<ModifierString> getModifiers();

	public abstract List<BattleRollDefinition> provideRollDefinitions();

	public abstract ManeuverResolverBase clone();

	/**
	 * @return
	 * @uml.property  name="accordingManeuver"
	 */
	@OneToOne(cascade=CascadeType.ALL)
	public OneManeuver getAccordingManeuver() {
		return accordingManeuver;
	}

	/**
	 * @param maneuver
	 * @uml.property  name="accordingManeuver"
	 */
	public void setAccordingManeuver(OneManeuver maneuver) {
		this.accordingManeuver = maneuver;
	}

	@Override
	public String getGuid() {
		return guid;
	}

	@Override
	protected void setGuid(String guid) {
		this.guid = guid;
	}
}
